<div class="container w-auto-xs" ng-controller="accessCiJobCtrl" ng-init="app.settings.container = false;">
    <div class="m-b-lg">
        <a href class="navbar-brand block m-t" style="color: #286090">持续集成任务详情</a>
        <button type="button" class="btn glyphicon glyphicon-arrow-left pull-left" ng-click="goBack()"></button>
    </div>

    <div class="m-b-lg">
        <div class="wrapper text-center">
        </div>

        <div class="panel" style="margin-top: 5px;">
            <div class="panel-body">
                <div class="wrapper-md">
                    <form class="form-horizontal">

                        <div class="wrapper-md">
                            <!-- toaster directive -->
                            <toaster-container
                                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>

                            <uib-tabset style="box-shadow: 0 0 5px #ddd;padding: 10px;">
                                <uib-tab index="0" heading="任务配置">

                                    <div style="font-size:1em;">&nbsp;</div>

                                    <div class="form-group">
                                        <div class="col-md-6">
                                            <label class="col-lg-4 control-label">任务名称
                                            </label>
                                            <div class="input-group" style="padding-left: 15px; padding-right: 15px">
                                                <input type="text" class="form-control" placeholder="任务名称" readonly
                                                       ng-model="jobItem.jobName">
                                                <div class="input-group-btn">
                                                    <button class="btn btn-default"
                                                            ng-click="checkJobName(jobItem.jobName)"><i
                                                            class="glyphicon glyphicon-check pull-right"></i></button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group build-params">
                                        <label class="col-lg-2 control-label">仓库地址</label>
                                        <div class="col-lg-10">
                                            <input type="text" class="form-control" placeholder="仓库地址" readonly
                                                   ng-model="appItem.sshUrl">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-md-6">
                                            <label class="col-lg-4 control-label">分支</label>
                                            <div class="col-lg-8">
                                                <!--required-->
                                                <select class="form-control" ng-model="jobItem.branch" readonly
                                                        ng-options="branch.name as branch.name for branch in jobItem.branchList">
                                                    <option value="">--请选择--</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <label class="col-lg-4 control-label">环境类型</label>
                                            <div class="col-lg-8">
                                                <!--required-->
                                                <select class="form-control" ng-model="jobItem.envType" readonly
                                                        ng-options="jobEnv.code as jobEnv.name for jobEnv in jobEnvType">
                                                    <option value="">--请选择--</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-md-6">
                                            <label class="col-lg-4 control-label">回滚类型</label>
                                            <div class="col-lg-8">
                                                <select class="form-control" ng-model="jobItem.rollbackType" readonly
                                                        ng-options="rollback.code as rollback.name for rollback in rollbackType">
                                                    <option value="">--请选择--</option>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="col-md-6">
                                            <label class="col-lg-4 control-label">构建类型</label>
                                            <div class="col-lg-8">
                                                <!--required-->
                                                <select class="form-control" ng-model="jobItem.ciType" readonly
                                                        ng-options="ci.code as ci.name for ci in ciType">
                                                    <option value="">--请选择--</option>
                                                </select>
                                            </div>
                                        </div>

                                    </div>

                                    <div class="form-group">
                                        <label class="col-lg-2 control-label">说明</label>
                                        <div class="col-lg-10">
                                            <textarea class="form-control" cols="3" placeholder="简短描述"
                                                      ng-model="jobItem.content" readonly></textarea>
                                        </div>
                                    </div>

                                </uib-tab>
                                <uib-tab index="1" heading="默认参数" ng-show="jobItem.id != 0">

                                    <div style="font-size:1em;">&nbsp;</div>

                                    <div style="margin-top: 5px;">
                                        <table class="table table-hover table-bordered table-striped"
                                               ng-show="jobItem.paramList != null && jobItem.paramList.length != 0">
                                            <thead>
                                            <tr>
                                                <!--class="col-md-10"-->
                                                <td>参数</td>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr ng-repeat="param in jobItem.paramList">
                                                <td>
                                     <span style="background-color: #286090; color: white;"
                                           uib-popover-html="{{param.content}}"
                                           popover-trigger="'mouseenter'"
                                           class="label">
                                                   <i ng-show="param.paramName =='branch'" class="fa fa-code-fork"></i>
                                                   <i ng-show="param.paramName =='sshUrl'" class="fa fa-git"></i>{{param.paramName}}</span>
                                                    </br>
                                                    <span class="label"
                                                          style="background-color: #20a03f; color: white;">{{param.paramValue}}</span>

                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </uib-tab>
                            </uib-tabset>
                        </div>


                        <div class="panel-body">
                            <div>
                                <table class="table table-hover table-bordered table-striped">
                                    <thead>
                                    <tr>
                                        <td class="col-md-1">编号</td>
                                        <td class="col-md-10">任务详情</td>
                                        <td class="col-md-1">操作</td>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="item in pageData">
                                        <td>
                                            <b style="color: #c9302c" ng-if="item.buildNumber ==-1">队列</b>
                                            <b style="color: #286090"
                                               ng-if="item.buildNumber > 0">{{item.buildNumber}}</b>
                                        </td>
                                        <td>
                                            <div ng-show="item.badgeIcon != ''"><img src="{{item.badgeIcon}}"></div>
                                            <b style="color: #286090">{{item.displayName}}</b>
                                            <span class="pull pull-right">
                                            {{(item.gmtModify == null || item.gmtModify == '') ? item.gmtCreate :
                                            item.gmtModify}}
                                            </span>
                                            <div class="col-md-12" style="margin-top:5px;"
                                                 ng-repeat="param in item.jobParams.params">
                                               <span style="background-color: #286090; color: white;"
                                                     uib-popover-html="'参数名称'"
                                                     popover-trigger="'mouseenter'"
                                                     class="label">
                                                   <i ng-show="param.name =='branch'" class="fa fa-code-fork"></i>
                                                   <i ng-show="param.name =='sshUrl'" class="fa fa-git"></i>{{param.name}}</span>
                                                <b style="color: #20a03f;">{{param.value}}</b>
                                            </div>
                                            <div class="col-md-12" style="margin-top:5px;"
                                                 ng-repeat="commit in item.commitList">
                                               <span style="background-color: #777777; color: white;"
                                                     uib-popover-html="'COMMIT'"
                                                     popover-trigger="'mouseenter'"
                                                     class="label">
                                                  {{commit.commit}}</span>
                                                <span style="background-color: #8278c2; color: white;" class="label">{{commit.message}}</span>
                                            </div>
                                            <!--margin: 0 auto  ;  height: 100px; margin-top:5px;-->

                                            <div class="col-md-12" style="margin-top:5px;"
                                                 ng-repeat="notify in item.notifyList">
                                            <span style="background-color: #00b3ee; color: white;"
                                                  uib-popover-html="'阶段'"
                                                  popover-trigger="'mouseenter'"
                                                  class="col-md-2 label">
                                                   <i class="fa fa-codepen"></i>{{notify.buildPhase}}</span>
                                                <span style="background-color: #2a2a2b; color: white;"
                                                      uib-popover-html="'时间'"
                                                      popover-trigger="'mouseenter'"
                                                      class="col-md-4 label">
                                                   <i class="glyphicon glyphicon-time"></i>{{notify.gmtCreate}}</span>
                                                <span style="background-color: #20a03f; color: white;"
                                                      ng-if="notify.buildStatus =='SUCCESS'"
                                                      uib-popover-html="'状态'"
                                                      popover-trigger="'mouseenter'"
                                                      class="col-md-4 label">
                                                   <i class="glyphicon glyphicon-ok"></i>{{notify.buildStatus}}</span>
                                                <span style="background-color: red; color: white;"
                                                      ng-if="notify.buildStatus != '' && notify.buildStatus !='SUCCESS'"
                                                      uib-popover-html="'状态'"
                                                      popover-trigger="'mouseenter'"
                                                      class="col-md-4 label">
                                                   <i class="glyphicon glyphicon-remove"></i>{{notify.buildStatus}}</span>
                                                <span style="background-color: #737373; color: white;"
                                                      ng-show="notify.dingtalk == true"
                                                      class="label pull-right">
                                                   <i class="fa fa-bell"></i>Dingtalk消息</span>
                                            </div>

                                            <div class="col-md-12" style="margin-top:5px;"
                                                 ng-repeat="artifact in item.artifactList">
                                                    <span style="background-color: #c9302c; color: white;"
                                                          ng-show="artifact.ossPath != ''"
                                                          uib-popover-html="'OSS://opscloud'"
                                                          popover-trigger="'mouseenter'"
                                                          class="label">
                                                   <i class="fa fa-codepen"></i>OSS</span>

                                                <span style="background-color: #ff5f87; color: white;"
                                                      ng-show="artifact.ossPath != ''"
                                                      uib-popover-html="'构件路径'"
                                                      popover-trigger="'mouseenter'"
                                                      class="label">{{artifact.ossPath}}</span>

                                                <span style="background-color: #737373; color: white;"
                                                      ng-show="artifact.ossPath != ''"
                                                      class="label">{{artifact.size}}</span>

                                                <span style="background-color: #ff8700; color: white;"
                                                      ng-show="artifact.ossPath == ''"
                                                      uib-popover-html="'构件'"
                                                      popover-trigger="'mouseenter'"
                                                      class="label">
                                                   <i class="fa fa-dropbox"></i>{{artifact.artifactName}}</span>
                                            </div>

                                        </td>
                                        <td>


                                            <a class="btn btn-xs"
                                               style="margin-top:5px; background-color: #737373; color: white;"
                                               href="{{item.console}}"
                                               target="_blank"><i class="fa fa-terminal"></i>日志</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="4">
                                            <ul style="margin: 0px; float: right;" uib-pagination
                                                total-items="totalItems"
                                                ng-model="currentPage" items-per-page="pageLength" max-size="10"
                                                ng-change="pageChanged(currentPage)" previous-text="&lsaquo;"
                                                next-text="&rsaquo;"></ul>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>

                        <div style="font-size:1em;">&nbsp;</div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
